#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @version : python3.9.0
# @Time    : 2022/2/8 19:44
# @Author  : qhh
# @Site    : hz_zimo
# @File    : record_cmd.py
# @Software: PyCharm
import os

url = r'http://t-rms.zimocloud.com/#/'
test_case_dir = '{}/test_dir/'.format(os.getcwd())
file_list = [os.path.join(test_case_dir, file) for file in os.listdir(test_case_dir) if "test_" in file]
test_case_num = len(file_list) - 2
print("{}目录下存在{}测试用例".format(test_case_dir, test_case_num))
cmd = r"python -m playwright codegen --target python -o ./test_dir/test_{}.py -b chromium {}".\
    format(str(test_case_num + 1).zfill(3), url)
print("执行录制测试用例命令：{}".format(cmd))
os.system(cmd)
